// var [a,b,c] = [1,2,3];
// console.log(a,b,c); 
//数组的解构赋值
// let [a = 4,b,c] = [,123,3] //a = 4; b = 123; c = 3;
// console.log(a,b,c);
//============================
//对象的解构赋值
//赋值的时候不分先后,对应名字即可
// let{foo,bar} = {foo : "hello", bar : "Hi"};
// console.log(foo, bar);
//对象的属性别名,如果赋予了别名,原来的名字就会无效
// let{foo : name, bar} = {foo: "hellp", bar : "Hi"};
// let{foo: name = "nihao", bar} = {bar: "Hi"};
// console.log(name,bar);
// console.log(name, bar);
//==================================
// 字符串的解构赋值
// let[q,w,e,r,t] = "hello";
// console.log(q,w,e,r,t);
//=================================
//字符串相关扩展
// includes();
//参数1--->判断字符串是否包含指定的字符串(true/false);
//参数2--->从第几个开始匹配;
console.log("hello world".includes("world", 6));
//startsWith()
//判断字符串是否是特定的字符串开始
let url = "admin/index.html";
console.log(url.startsWith("admin"));
//endsWith()
//判断字符踹是否是特定的字符串结束
console.log(url.endsWith("html"));
//=================================
//模板字符串:

//===================================
//函数的扩展:
//可以直接在这里传默认值
function foo(name = "海洋", age = 18){
    console.log(name, age);
}
foo("你好",25);
//参数解构赋值
function por({name,age} = {name: "kalixi", age: 28}) {
    console.log(name, age);
}
por({name: "ailiya", age: 18});

//rest参数(剩余参数)
function fn(a,b,...rest){
    console.log(a);  //1
    console.log(b);//2
    //... 就是剩余的参数,放到一个数组中
    console.log(...rest);//3 4 5 6 7 
    
}
//拓展运算符
fn(1,2,3,4,5,6,7);
function fc(a,b,c,d,e){
    console.log(a + b + c + d + e);
}
var arr = [1,2,3,4,5]
//把一个数组拆散变成的单个的
fc(...arr);
